<template>
  <div class="home">
    <input type="text" v-model="dd">
    <hr />
    <commonTabel height="500" size="mini" :border="true" :stripe="true" @row-click="rowClick" :columns="columns" :listdata="list" >
      <template #action>
        <div >
            <el-button type="primary">编辑</el-button>
            <el-button type="danger">删除</el-button>
        </div>
      </template>
    </commonTabel >
  </div>
</template>

<script>
// @ is an alias to /src
import commonTabel  from '../components/commonTabel.vue';

export default {
  name: 'Home',
  components:{commonTabel},
 data(){
  return {
    dd:"",
    list:[{name:"校长",age:18,sex:"男"},{name:"王德法",age:19,sex:"男"},{name:"张三",age:20,sex:"男"}],
    columns:[{
      label:"姓名",
      prop:"name",
       key:'name'
    },
  {
      label:"年龄",
      prop:"age",
       key:'age'
    },
   {
      label:"性别",
      prop:"sex",
       key:'sex'
  
    },
  {
      label:"操作",
      key:'action'
    }]
  }
 },
 methods:{
  rowClick(row){
    console.log(row,"----------------")
  }
 },
 mounted() {
  // this.$root 根实例  main.js 的new Vue
  console.log(this.$root.name,"-----------")
 },
}
</script>
